﻿
using Furion.DatabaseAccessor;
using ST.Torch.WebApi.Core.Entities.System;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Text;
using System.Threading.Tasks;

namespace ST.Torch.WebApi.Core.Entities.SeedData
{
    public class SYSMenuSeedData : IEntitySeedData<SYSMenu>
    {
        
        public IEnumerable<SYSMenu> HasData(DbContext dbContext, Type dbContextLocator)
        {
            List<SYSMenu> AllData=new List<SYSMenu> { };
            SYSMenu sys=new SYSMenu();
         
            sys.Title="系统配置";
            sys.PermissionId= "SystemMenu";
            sys.Icon= "layui-icon layui-icon-console";
            sys.OpenType = "_component";
            sys.Type = 0;
            sys.Href = "/";
            sys.CascadeId = sys.Id.ToString().ToLower();


            #region 菜单
            SYSMenu sys1 = new SYSMenu();
            sys1.Title = "菜单";
            sys1.PermissionId = "MenuPage";
            sys1.Icon = "layui-icon layui-icon-console";
            sys1.OpenType = "_component";
            sys1.Type = MenuTypeEnum.Page;
            sys1.Href = "/SYS/Menu/Index";
            sys1.ParentId = sys.Id;
            sys1.Sort= 1;
            sys1.CascadeId = sys.Id.ToString().ToLower()+"."+ sys1.Id.ToString().ToLower();
            SYSMenu sys11 = new SYSMenu();
            sys11.Title = "添加菜单";
            sys11.PermissionId = "AddMenuPage";
            sys11.Icon = "layui-icon layui-icon-console";
            sys11.OpenType = "_component";
            sys11.Type = MenuTypeEnum.Button;
            sys11.Href = "-";
            sys11.ParentId = sys1.Id;
            sys11.Sort = 1;
            sys11.CascadeId = sys.Id.ToString().ToLower() + "." + sys1.Id.ToString().ToLower() + "." + sys11.Id.ToString().ToLower();
            SYSMenu sys12 = new SYSMenu();
            sys12.Title = "删除菜单";
            sys12.PermissionId = "DelMenuPage";
            sys12.Icon = "layui-icon layui-icon-console";
            sys12.OpenType = "_component";
            sys12.Type = MenuTypeEnum.Button;
            sys12.Href = "-";
            sys12.ParentId = sys1.Id;
            sys12.Sort = 1;
            sys12.CascadeId = sys.Id.ToString().ToLower() + "." + sys1.Id.ToString().ToLower() + "." + sys12.Id.ToString().ToLower();
            SYSMenu sys13 = new SYSMenu();
            sys13.Title = "编辑菜单";
            sys13.PermissionId = "EditMenuPage";
            sys13.Icon = "layui-icon layui-icon-console";
            sys13.OpenType = "_component";
            sys13.Type = MenuTypeEnum.Button;
            sys13.Href = "-";
            sys13.ParentId = sys1.Id;
            sys13.Sort = 1;
            sys13.CascadeId = sys.Id.ToString().ToLower() + "." + sys1.Id.ToString().ToLower() + "." + sys13.Id.ToString().ToLower();

            #endregion

            #region 用户


            SYSMenu sys2 = new SYSMenu();
            sys2.Title = "用户";
            sys2.PermissionId = "UserPage";
            sys2.Icon = "layui-icon layui-icon-console";
            sys2.OpenType = "_component";
            sys2.Type = MenuTypeEnum.Page;
            sys2.Href = "/SYS/User/Index";
            sys2.ParentId = sys.Id;
            sys2.Sort = 2;
            sys2.CascadeId = sys.Id.ToString().ToLower() + "." + sys2.Id.ToString().ToLower();
            SYSMenu sys21 = new SYSMenu();
            sys21.Title = "添加用户";
            sys21.PermissionId = "AddUserPage";
            sys21.Icon = "layui-icon layui-icon-console";
            sys21.OpenType = "_component";
            sys21.Type = MenuTypeEnum.Button;
            sys21.Href = "-";
            sys21.ParentId = sys2.Id;
            sys21.Sort = 1;
            sys21.CascadeId = sys.Id.ToString().ToLower() + "." + sys2.Id.ToString().ToLower() + "." + sys21.Id.ToString().ToLower();
            SYSMenu sys22 = new SYSMenu();
            sys22.Title = "删除用户";
            sys22.PermissionId = "DelUserPage";
            sys22.Icon = "layui-icon layui-icon-console";
            sys22.OpenType = "_component";
            sys22.Type = MenuTypeEnum.Button;
            sys22.Href = "-";
            sys22.ParentId = sys2.Id;
            sys22.Sort = 2;
            sys22.CascadeId = sys.Id.ToString().ToLower() + "." + sys2.Id.ToString().ToLower() + "." + sys22.Id.ToString().ToLower();
            SYSMenu sys23 = new SYSMenu();
            sys23.Title = "编辑用户";
            sys23.PermissionId = "EditUserPage";
            sys23.Icon = "layui-icon layui-icon-console";
            sys23.OpenType = "_component";
            sys23.Type = MenuTypeEnum.Button;
            sys23.Href = "-";
            sys23.ParentId = sys2.Id;
            sys23.Sort = 3;
            sys23.CascadeId = sys.Id.ToString().ToLower() + "." + sys2.Id.ToString().ToLower() + "." + sys23.Id.ToString().ToLower();
            SYSMenu sys24 = new SYSMenu();
            sys24.Title = "分配角色权限";
            sys24.PermissionId = "AssignRoleUserPage";
            sys24.Icon = "layui-icon layui-icon-console";
            sys24.OpenType = "_component";
            sys24.Type = MenuTypeEnum.Button;
            sys24.Href = "-";
            sys24.ParentId = sys2.Id;
            sys24.Sort = 4;
            sys24.CascadeId = sys.Id.ToString().ToLower() + "." + sys2.Id.ToString().ToLower() + "." + sys24.Id.ToString().ToLower();
            #endregion

            #region 角色
            SYSMenu sys3 = new SYSMenu();
            sys3.Title = "角色";
            sys3.PermissionId = "RolePage";
            sys3.Icon = "layui-icon layui-icon-console";
            sys3.OpenType = "_component";
            sys3.Type = MenuTypeEnum.Page;
            sys3.Href = "/SYS/Role/Index";
            sys3.ParentId = sys.Id;
            sys3.Sort = 3;
            sys3.CascadeId = sys.Id.ToString().ToLower() + "." + sys3.Id.ToString().ToLower();

            SYSMenu sys31 = new SYSMenu();
            sys31.Title = "添加角色";
            sys31.PermissionId = "AddRolePage";
            sys31.Icon = "layui-icon layui-icon-console";
            sys31.OpenType = "_component";
            sys31.Type = MenuTypeEnum.Button;
            sys31.Href = "-";
            sys31.ParentId = sys3.Id;
            sys31.Sort = 1;
            sys31.CascadeId = sys.Id.ToString().ToLower() + "." + sys3.Id.ToString().ToLower() + "." + sys31.Id.ToString().ToLower();
            SYSMenu sys32 = new SYSMenu();
            sys32.Title = "删除角色";
            sys32.PermissionId = "DelRolePage";
            sys32.Icon = "layui-icon layui-icon-console";
            sys32.OpenType = "_component";
            sys32.Type = MenuTypeEnum.Button;
            sys32.Href = "-";
            sys32.ParentId = sys3.Id;
            sys32.Sort = 2;
            sys32.CascadeId = sys.Id.ToString().ToLower() + "." + sys3.Id.ToString().ToLower() + "." + sys32.Id.ToString().ToLower();
            SYSMenu sys33 = new SYSMenu();
            sys33.Title = "修改角色";
            sys33.PermissionId = "EditRolePage";
            sys33.Icon = "layui-icon layui-icon-console";
            sys33.OpenType = "_component";
            sys33.Type = MenuTypeEnum.Button;
            sys33.Href = "-";
            sys33.ParentId = sys3.Id;
            sys33.Sort = 3;
            sys33.CascadeId = sys.Id.ToString().ToLower() + "." + sys3.Id.ToString().ToLower() + "." + sys33.Id.ToString().ToLower();
            SYSMenu sys34 = new SYSMenu();
            sys34.Title = "分配菜单权限";
            sys34.PermissionId = "AssignmentMenuRolePage";
            sys34.Icon = "layui-icon layui-icon-console";
            sys34.OpenType = "_component";
            sys34.Type = MenuTypeEnum.Button;
            sys34.Href = "-";
            sys34.ParentId = sys3.Id;
            sys34.Sort = 4;
            sys34.CascadeId = sys.Id.ToString().ToLower() + "." + sys3.Id.ToString().ToLower() + "." + sys34.Id.ToString().ToLower();

            #endregion

            #region 权限--
            SYSMenu sys4 = new SYSMenu();
            sys4.Title = "按钮权限-所有权限控制";
            sys4.PermissionId = "PermPage";
            sys4.Icon = "layui-icon layui-icon-console";
            sys4.OpenType = "_component";
            sys4.Type = MenuTypeEnum.Menu;
            sys4.Href = "/";
            sys4.IsHide = true;
            sys4.Sort = 4;
            sys4.CascadeId = sys4.Id.ToString().ToLower();

            SYSMenu sys41 = new SYSMenu();
            sys41.Title = "通用添加数据";
            sys41.PermissionId = "GeneralAddDataPerm";
            sys41.Icon = "layui-icon layui-icon-console";
            sys41.OpenType = "_component";
            sys41.Type = MenuTypeEnum.Button;
            sys41.Href = "-";
            sys41.ParentId = sys4.Id;
            sys41.Sort = 1;
            sys41.CascadeId =  sys4.Id.ToString().ToLower() + "." + sys41.Id.ToString().ToLower();
            SYSMenu sys42 = new SYSMenu();
            sys42.Title = "通用删除数据";
            sys42.PermissionId = "GeneralDelDataPerm";
            sys42.Icon = "layui-icon layui-icon-console";
            sys42.OpenType = "_component";
            sys42.Type = MenuTypeEnum.Button;
            sys42.Href = "-";
            sys42.ParentId = sys4.Id;
            sys42.Sort = 2;
            sys42.CascadeId =  sys4.Id.ToString().ToLower() + "." + sys42.Id.ToString().ToLower();
            SYSMenu sys43 = new SYSMenu();
            sys43.Title = "通用修改数据";
            sys43.PermissionId = "GeneralEditDataPerm";
            sys43.Icon = "layui-icon layui-icon-console";
            sys43.OpenType = "_component";
            sys43.Type = MenuTypeEnum.Button;
            sys43.Href = "-";
            sys43.ParentId = sys4.Id;
            sys43.Sort = 3;
            sys43.CascadeId =  sys4.Id.ToString().ToLower() + "." + sys43.Id.ToString().ToLower();

            SYSMenu sys44 = new SYSMenu();
            sys44.Title = "通用Excecl导出数据";
            sys44.PermissionId = "GeneralExportDataPerm";
            sys44.Icon = "layui-icon layui-icon-console";
            sys44.OpenType = "_component";
            sys44.Type = MenuTypeEnum.Button;
            sys44.Href = "-";
            sys44.ParentId = sys4.Id;
            sys44.Sort = 3;
            sys44.CascadeId = sys4.Id.ToString().ToLower() + "." + sys44.Id.ToString().ToLower();
            

            #endregion


            #region 常用实例方法
            SYSMenu sysT4 = new SYSMenu();
            sysT4.Title = "常用实例方法";
            sysT4.PermissionId = "SystemMenu";
            sysT4.Icon = "layui-icon layui-icon-console";
            sysT4.OpenType = "_component";
            sysT4.Type = 0;
            sysT4.Href = "/";
            sysT4.Sort = 2;
            sysT4.CascadeId = sysT4.Id.ToString().ToLower();

            SYSMenu sysT41 = new SYSMenu();
            sysT41.Title = "Excel导入导出";
            sysT41.PermissionId = "ExcelInOutPage";
            sysT41.Icon = "layui-icon layui-icon-console";
            sysT41.OpenType = "_component";
            sysT41.Type = MenuTypeEnum.Page;
            sysT41.Href = "/Utils/Excel/Index";
            sysT41.ParentId = sysT4.Id;
            sysT41.Sort = 1;
            sysT41.CascadeId = sysT4.Id.ToString().ToLower() + "." + sysT41.Id.ToString().ToLower();
            SYSMenu sysT42 = new SYSMenu();
            sysT42.Title = "表单";
            sysT42.PermissionId = "FormDataPage";
            sysT42.Icon = "layui-icon layui-icon-console";
            sysT42.OpenType = "_component";
            sysT42.Type = MenuTypeEnum.Page;
            sysT42.Href = "/Utils/Form/Index";
            sysT42.ParentId = sysT4.Id;
            sysT42.Sort = 2;
            sysT42.CascadeId = sysT4.Id.ToString().ToLower() + "." + sysT42.Id.ToString().ToLower();
            SYSMenu sysT43 = new SYSMenu();
            sysT43.Title = "代码自动生成模板";
            sysT43.PermissionId = "AutomaticCodeGenerationPage";
            sysT43.Icon = "layui-icon layui-icon-console";
            sysT43.OpenType = "_component";
            sysT43.Type = MenuTypeEnum.Page;
            sysT43.Href = "/Utils/AutomaticCodeGeneration/Index";
            sysT43.ParentId = sysT4.Id;
            sysT43.Sort = 3;
            sysT43.CascadeId = sysT4.Id.ToString().ToLower() + "." + sysT42.Id.ToString().ToLower();
            #endregion

            //SYSRole sYSRole = new SYSRole();
            //sYSRole.Name = "管理员";
            //sYSRole.RoleCode = "Administrator";

            //SYSUser sYSUser = new SYSUser();
            //sYSUser.Account = "Administrator";
            //sYSUser.Password = sYSUser.GetPassEncryption("000000");
            //sYSUser.IsEnable=true;


            AllData.Add(sys);
            AllData.Add(sys1);
            AllData.Add(sys11);
            AllData.Add(sys12);
            AllData.Add(sys13);
            AllData.Add(sys2);
            AllData.Add(sys21);
            AllData.Add(sys22);
            AllData.Add(sys23);
            AllData.Add(sys24);

            AllData.Add(sys3);
            AllData.Add(sys31);
            AllData.Add(sys32);
            AllData.Add(sys33);
            AllData.Add(sys34);

            AllData.Add(sys4);
            AllData.Add(sys41);
            AllData.Add(sys42);
            AllData.Add(sys43);
            AllData.Add(sys44);


            AllData.Add(sysT4);
            AllData.Add(sysT41);
            AllData.Add(sysT42);
            AllData.Add(sysT43);

            return AllData;
        } 
        
           
    }

    


}
